package com.woniu.account.controller;


import com.woniu.account.dto.coachResume.CoachResumeDto;
import com.woniu.account.form.coachResume.AddCoachResumeFrom;
import com.woniu.account.form.coachResume.UpdateCoachResumeFrom;
import com.woniu.account.model.CoachResume;
import com.woniu.account.service.CoachResumeService;
import com.woniu.model.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 杜岷芫
 * @since 2024年07月11日
 */
@Api(tags = "教练简历")
@RestController
@RequestMapping("/coachResume")
public class CoachResumeController {
    @Autowired
    private CoachResumeService coachResumeService;
    //教练新增
    @PostMapping("/add")
    public Result add(@RequestBody AddCoachResumeFrom from) {
        coachResumeService.add(from);
        return Result.getResult().setMsg("成功");
    }
    //教练修改
    @PostMapping("/update")
    public Result update(@RequestBody UpdateCoachResumeFrom from) {
        CoachResumeDto coachResume = coachResumeService.updateCoachResume(from);
        return Result.getResult().setData(coachResume).setMsg("成功");
    }
    //根据教练id查看
    @GetMapping("/getCoachResumeById/{id}")
    public Result getCoachResumeById(@PathVariable("id") Integer id) {
        CoachResumeDto coachResume = coachResumeService.getCoachResumeById(id);
        return Result.getResult().setData(coachResume).setMsg("成功");
    }

}

